<script setup lang="ts">
import { ref } from 'vue';

const timeMsg = ref<string>('');

setInterval(() => {
  const now = new Date();
  const year = now.getFullYear();
  const month = (now.getMonth() + 1).toString().padStart(2, '0');
  const day = now.getDate().toString().padStart(2, '0');
  const hours = now.getHours().toString().padStart(2, '0');
  const minutes = now.getMinutes().toString().padStart(2, '0');
  const seconds = now.getSeconds().toString().padStart(2, '0');
  timeMsg.value = `${year}-${month}-${day}-${hours}:${minutes}:${seconds}`;
}, 1000);
</script>

<template>
<h1>欢迎您的光临</h1>
{{ timeMsg }}
</template>
